<div class="im_message_outer_wrap" ng-click="toggleMessage(historyMessage.mid, $event)">


  <div class="im_message_wrap clearfix" ng-switch="::historyMessage._ == 'messageService'">

    <div class="im_service_message_wrap" ng-switch-when="true" ng-switch="historyMessage.action._ == 'messageActionBotIntro'">
      <div ng-switch-when="true" class="im_bot_intro_message_wrap">
        <div class="im_bot_intro_message_header" my-i18n="message_service_bot_intro_header"></div>
        <div class="im_bot_intro_message" ng-bind-html="::historyMessage.action.rDescription"></div>
      </div>
      <div ng-switch-default class="im_service_message">
        <a class="im_message_author" ng-if="::historyMessage.fromID > 0" my-peer-link="historyMessage.fromID" short="historyMessage.peerID > 0" color="historyMessage.peerID < 0" no-watch="true"></a>
        <span class="im_message_service" my-service-message="historyMessage"></span>
      </div>

      <a ng-if="::historyMessage.action._ == 'messageActionChatEditPhoto' || historyMessage.action._ == 'messageActionChannelEditPhoto'" class="im_service_message_photo_thumb" href="" ng-click="openPhoto(historyMessage.action.photo.id)">
        <img
          class="im_service_message_photo_thumb"
          my-load-thumb
          thumb="historyMessage.action.photo.thumb"
        />
      </a>

    </div>

    <div ng-switch-default class="im_content_message_wrap" ng-class="::[historyMessage.pFlags.out ? 'im_message_out' : 'im_message_in', historyMessage.fwdFromID ? 'im_message_fwd' : '']">

      <a class="im_message_from_photo pull-left" my-peer-photolink="::historyMessage.fromID" img-class="im_message_from_photo"></a>

      <div class="im_message_meta">
        <div class="im_message_views_wrap" ng-if="::historyMessage.views > 0">
          <div class="im_message_views">
            <i class="icon-message-views"></i><span class="im_message_views_cnt" my-message-views="historyMessage.mid"></span>
          </div>
        </div>
        <a class="im_message_error_btn" ng-if="::historyMessage.pending || historyMessage.error || false" ng-click="historyMessage.send()">
          <i class="icon-message-status" tooltip="{{'message_action_retry' | i18n}}"></i>
        </a>
        <span class="im_message_date">
          <span class="im_message_edited" my-message-edited="historyMessage.mid"></span>
          <span class="im_message_date_text">
            <i ng-if="::historyMessage.pFlags.out &amp;&amp; (historyMessage.pFlags.unread || historyMessage.pending) || false" class="icon-message-status" ng-show="!historyMessage.error"></i>
            <span ng-bind="::historyMessage.date | time"></span>
          </span>
        </span>
      </div>

      <div my-message-body="historyMessage">
        <div class="im_message_body" ng-class="::{im_message_body_media: historyMessage._ == 'message' &amp;&amp; historyMessage.media && historyMessage.media._ != 'messageMediaWebPage' && !historyMessage.media.rCaption && !historyMessage.viaBotID ? true : false}">

          <a class="im_message_author" my-peer-link="historyMessage.fromID" short="historyMessage.peerID > 0" color="historyMessage.peerID < 0" no-watch="true"></a>
          <a ng-if="::historyMessage.viaBotID && !historyMessage.fwdFromID" class="im_message_author_via" my-i18n="message_via_bot" ng-click="selectInlineBot(historyMessage.viaBotID, $event)"><my-i18n-param name="bot"><span class="im_message_fwd_author" my-peer-link="historyMessage.viaBotID" username="true" no-watch="true"></span></my-i18n-param></a>
          <span class="im_message_author_admin" my-message-admin-badge="historyMessage"></span>

          <a class="im_message_reply_wrap" my-reply-message="::historyMessage.reply_to_mid" ng-if="::historyMessage.reply_to_mid"></a>

          <div ng-if="::!!historyMessage.fwdFromID &amp;&amp; !historyMessage.media" class="im_message_fwd_header" ng-switch="!!historyMessage.viaBotID" my-i18n>
            <span ng-switch-when="true" my-i18n-format="message_forwarded_via_message_mobile"></span>
            <span ng-switch-default my-i18n-format="message_forwarded_message_mobile"></span>
            <my-i18n-param name="from"><a class="im_message_fwd_author" my-peer-link="historyMessage.fwdFromID" no-watch="true" post-id="historyMessage.fwdPostID"></a></my-i18n-param>
            <my-i18n-param name="bot"><a class="im_message_fwd_author" my-peer-link="historyMessage.viaBotID" username="true" no-watch="true"></a></my-i18n-param>
          </div>

          <div class="im_message_text" dir="auto"></div>
          <div class="im_message_media"></div>
          <div class="im_message_sign"></div>

        </div>

        <div class="im_message_keyboard"></div>

      </div>

    </div>
  </div>

</div>

